package itheima.d10;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class Test {
    public static void main(String[] args) {
        List<String> list =new ArrayList<>();
        list.add("宝强");
        list.add("贾乃亮");
        list.add("潘长江");
        list.add("李悦凯");
        list.add("章人生");


        for (int i = 0; i < list.size(); i++) {
            System.out.println(list.get(i));
        }
        System.out.println("===================");

        for (String s : list) {
            System.out.println(s);
        }
        System.out.println("===============================");
        list.forEach(s -> System.out.println(s));

        System.out.println("====================================");

        Iterator<String> iterator = list.iterator();
        while (iterator.hasNext()) {
            String s = iterator.next();
            System.out.println(s);
        }
    }
}
